
package com.xbongbong.pro.domain.dao;

import com.xbongbong.pro.domain.entity.ChartCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;
import java.util.Map;


/**
 * @author autoGen
 * @time 2019-01-07 11:13:40
 */
@Repository
@Mapper
public interface ChartCategoryDao {

    Integer insert(ChartCategoryEntity chartCategory);

    Integer update(ChartCategoryEntity chartCategory);

    void insertBatch(@Param("list") List<ChartCategoryEntity> chartCategoryList);

    Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);

    ChartCategoryEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);


    List<ChartCategoryEntity> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 批量更新
     * @author youli.chen
     * @param param 参数
     */
    void batchUpdateEnable(@Param("param") Map<String, Object> param);

    /**
     * 根据别名查询
     * @param param
     * @author xingxing.xiao
     */
    ChartCategoryEntity getEntityByAlias(@Param("param") Map<String, Object> param);

    /**
     * 得到重复初始化的分类alias
     * 接口：chart/category/init/categoryAndChart
     * 最终对比corpid=0分类和当前公司分类数量的方法：ChartInitHelp.chartCategoryInit
     * @param param
     * @return java.util.List<com.xbongbong.pro.domain.entity.ChartCategoryEntity>
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    List<ChartCategoryEntity> getOverInitAlias(@Param("param") Map<String, Object> param);

    /**
     * 物理删除
     * 直接删除这条记录
     *
     * @param corpid 公司id
     * @param idIn   主键
     * @return 删除结果
     */
    Integer physicalDelete(@Param("corpid") String corpid, @Param("idIn") Collection<Long> idIn);

    /**
     * 查询公司id集合
     * @return java.util.List<java.lang.String>
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    List<String> getCorpidList();

    void updateBatch(@Param("list") List<ChartCategoryEntity> entityList, @Param("corpid") String corpid);

    void updateName(@Param("id") Long id, @Param("name") String name);

    void updatePublishFlag(@Param("id") Long id, @Param("publish") Integer publish, @Param("corpid") String corpid);

    void updateGlobalStyle(ChartCategoryEntity chartCategoryEntity);

    /**
     * 批量更新数据
     * @param entityList
     * @param corpidList
     * @return void
     */
    void updateBatch4Script(@Param("list")List<ChartCategoryEntity> entityList, @Param("corpidList")List<String> corpidList);
}